package com.itheima.edu.info.manager.service;

import com.itheima.edu.info.manager.dao.StudentDao;
import com.itheima.edu.info.manager.domain.Student;

public class StudentService {


    public boolean addStudent(Student student) {
        StudentDao studentDao = new StudentDao();
        return studentDao.addStudent(  student);
    }

    public Student[] findAllStudent() {
        StudentDao studentDao=new StudentDao();
        Student[] allstudent=studentDao.findAllStudent();
        boolean flag=false;
        for (int i = 0; i < allstudent.length; i++) {
            Student students=allstudent[i];
            if(students!=null){
                flag=true;
                break;
            }

        }
        if(flag){
            return allstudent;
        }else{
            return null;
        }

    }

    public boolean deleteStudentById(String delid) {
        StudentDao studentDao = new StudentDao();

        return studentDao.deleteStudentById(delid);

    }
}




